#! /bin/sh -vx
# $Id$
# Copyright 2017 Karl Berry <tex-live@tug.org>
# Copyright 2009, 2011 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.

W2CDir=${W2CDir:-..}
BinDir=${BinDir:-.}
ExeExt=${ExeExt:-}
_pltotf=$W2CDir/pltotf$ExeExt
_tftopl=$W2CDir/tftopl$ExeExt
_omfonts=$BinDir/omfonts$ExeExt

tests=tests

test -d $tests || mkdir -p $tests
rc=0

$_pltotf $srcdir/$tests/Cherokee $tests/Cherokee || rc=1

TEXMFCNF=$srcdir/../../kpathsea \
  $_tftopl $tests/Cherokee $tests/xCherokee || rc=2

diff $srcdir/$tests/Cherokee.pl $tests/xCherokee.pl || rc=3

TEXMFCNF=$srcdir/../../kpathsea \
  OFMFONTS=$tests \
  $_omfonts -ovp2ovf -verbose $srcdir/$tests/OCherokee $tests/OCherokee $tests/OCherokee || rc=4

TEXMFCNF=$srcdir/../../kpathsea \
  $_omfonts -ofm2opl -verbose $tests/OCherokee $tests/OCherokee || rc=5

TEXMFCNF=$srcdir/../../kpathsea \
  $_omfonts -opl2ofm -verbose $tests/OCherokee $tests/xOCherokee || rc=6

TEXMFCNF=$srcdir/../../kpathsea \
  $_omfonts -ofm2opl -verbose $tests/xOCherokee $tests/xOCherokee || rc=7

diff $tests/OCherokee.opl $tests/xOCherokee.opl || rc=8

TEXMFCNF=$srcdir/../../kpathsea \
  OFMFONTS=".;./$tests" \
  $_omfonts -ovf2ovp -verbose $tests/OCherokee $tests/OCherokee $tests/xOCherokee || rc=9

diff $srcdir/$tests/OCherokee.ovp $tests/xOCherokee.ovp || rc=10

exit $rc
